{extend name="template/base" /}
{block name="content"}
<div class="page-container">

    <div class="cl pd-5 bg-1 bk-gray">
        <span class="l">

        </span>
        <span class="r pt-5 pr-5">
            共有数据 ：<strong>{$count}</strong> 条
        </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            {include file="th" /}
            <th width="70">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            {include file="td" /}
            <td class="f-14">
                {tp:menu menu='sdelete' url='topDelete'/}
            </td>
        </tr>
        {/volist}
        <tr>
            <td colspan="11"><label class="label label-primary sel_store_btn">确认选择</label></td>
        </tr>
        </tbody>
    </table>
    <div class="page-bootstrap" id="page-bar">{$page}</div>
</div>
{/block}
{block name='script'}
<link rel="stylesheet" type="text/css" media="screen" href="__LIB__/lightbox2/css/lightbox.css" />
<script type="text/javascript" src="__LIB__/lightbox2/js/lightbox.js"></script>
<script>
    function cellbackTypesSelected(typesId) {
        $.post('{:\\think\\Url::build("topAdd")}', {tIds:typesId}, function (data) {
            if (data.success) {
                layer.msg("添加成功", {icon: 1, time: 1000});
                window.location.reload();
            } else {
                layer.alert(data.msg);
            }
        }, 'json')
    }
    function selectSecondTypes() {
        layer_open('选择商品','/admin/mk.types/second_select"',{
            fun:function (layero,index,layer) {
                layero.find('iframe').contents().find('.sel_store_btn').on("click", function (obj) {
                    var ids = [];
                    layero.find('iframe').contents().find(":checked[name='id[]']").each(function () {
                        ids.push($(this).val())
                    });
                    cellbackTypesSelected(ids);
                    layer.close(index);
                });
            }
        });
    }
</script>
{/block}